# -*- coding: utf-8 -*-
import scrapy


class SinaSpider(scrapy.Spider):
    name = 'sina'
    allowed_domains = ['news.sina.com.cn']
    start_urls = ['http://news.sina.com.cn/guide/']

    def parse(self, response):
        dlist = response.selector.css('div.section')
        for h2 in dlist:
            title = h2.css('h2.tit01::text').extract()
            if len(title) == 2:
                print(title[0] +  '·' + title[1])
            else:
                print(title[0])
            print('='*70)
            hlist = h2.css('div.clearfix')
            for h3 in hlist:
                print(h3.xpath('./h3//text()').extract_first())
                print('-'*70)
                ulist = h3.css('ul.list01 li')
                for li in ulist:
                    print(li.css('::text').extract_first(),end=' ')
                print()
                print('-'*70)
            print('='*70)